//package org.example.chapter5.main;
//
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.boot.autoconfigure.domain.EntityScan;
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
//import org.springframework.stereotype.Repository;
//
///**
// * @author CoderXshuai
// * @date 2020/7/27/0027 14:06
// */
////定义spring boot的扫描包路径
//@SpringBootApplication(scanBasePackages = {"org.example.chapter5"})
////定义JPA接口扫描包路径
//@EnableJpaRepositories(basePackages = "org.example.chapter5.dao")
////定义实体Bean扫描包路径
//@EntityScan(basePackages = "org.example.chapter5.pojo")
////定义mybatis的扫描
//@MapperScan(
//        //指定扫描包
//        basePackages = "org.example.chapter5.*",
//        //指定SqlSessionFactory,如果sqlSessionTemplate被指定,则作废
//        sqlSessionFactoryRef = "sqlSessionFactory",
//        //指定sqlSessionTemplate,将忽略sqlSessionFactory的配置
//        sqlSessionTemplateRef = "sqlSessionTemplate",
//        //markerInterface=Class.class,限定扫描接口,不常用
//        annotationClass = Repository.class
//)
//public class Chapter5Application {
//    @Autowired
//    SqlSessionFactory sqlSessionFactory = null;
//
//    public static void main(String[] args) {
//        SpringApplication.run(Chapter5Application.class, args);
//    }
//
////    @Bean
////    public MapperFactoryBean<MyBatisUserDao> initMybatisUserDao() {
////        MapperFactoryBean<MyBatisUserDao> bean = new MapperFactoryBean<>();
////        bean.setMapperInterface(MyBatisUserDao.class);
////        bean.setSqlSessionFactory(sqlSessionFactory);
////        return bean;
////    }
////    @Bean
////    public MapperScannerConfigurer mapperScannerConfig() {
////        //定义扫描器实例
////        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
////        //加载SqlSessionFactory,Spring Boot会自动生成,SqlSessionFactory实例
////        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
////        //定义被扫描的包
////        mapperScannerConfigurer.setBasePackage("org.example.chapter5.*");
////        //限定被标注为@Repository的接口才被扫描
////        mapperScannerConfigurer.setAnnotationClass(Repository.class);
////        //通过继承某个接口限制扫描,一般使用不多
//////        mapperScannerConfigurer.setMarkerInterface(......);
////        return mapperScannerConfigurer;
////    }
//
//}
